package com.oa.handler;

import com.oa.config.MyFreemarkerView;
import com.oa.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

@Component
public class RunHanler implements CommandLineRunner {

    private static final Logger logger= LoggerFactory.getLogger(RunHanler.class);

    @Autowired
    private FreeMarkerViewResolver resolver;

    @Autowired
    private UserService userService;

    @Override
    public void run(String... strings) throws Exception {
        logger.info("开始执行初始化");
        resolver.setViewClass(MyFreemarkerView.class);
        userService.init();
    }

}
